<?php
$http = new Swoole\Http\Server("0.0.0.0", 9501);
$http->on('request', function ($request, $response) {
    $username = $request->post['username'];
    $password = $request->post['password'];

    Swoole\Runtime::enableCoroutine($flags = SWOOLE_HOOK_ALL);
    $mysqli = new mysqli('192.168.56.1', 'work', '111111', 'hyperf_usercenter');
    $sql = "select id,password from users where account='{$username}'";
    var_dump($sql);
    $mysqlResult = $mysqli->query($sql);
    var_dump($mysqlResult);
    $msg = 'faild';
    if ($mysqlResult) {
        $row = $mysqlResult->fetch_row();
        if ($row[1] == $password) {
            $key = 'Content-type';
            $value = 'application/json';
            $response->header($key, $value, true);
            $msg = "succ";
        }
    }
    $rt = ['msg' => $msg];
    $response->end(json_encode($rt));
});
$http->start();
